|
|
|
|
|
|
|
'
On Error GoTo LocalError
'
Select Case Index
Case 0 ' add
datFieldTypes.Recordset.AddNew
Case 1 ' update
datFieldTypes.UpdateRecord
datFieldTypes.Recordset.Bookmark =
datFieldTypes.Recordset.LastModified
Case 2 ' delete
datFieldTypes.Recordset.Delete
datFieldTypes.Recordset.MovePrevious
Case 3 ' exit
Unload Me
End Select
Exit Sub
'
LocalError:
MsgBox Err.Description, vbCritical, Err.Number
'
End Sub |
|
|
|
|
|
|
|
|
There may be several things in this code segment that are new to you. First, different lines of code are executed based on the button that is pushed by the user. This is indicated by the Index parameter that is passed to the Click event. Second, some error-handling code has been added to make it easy for you to experiment with the data form. You learn more about error-handling in Day 14, "Error Handling in Visual Basic 5.0." Don't worry if this code segment looks a bit confusing. For now, just go ahead and enter the code that is shown here. |
|
|
|
|
|
|
|
|
Now is a good time to save the project. Save the form as FieldTypes.frm and the project as FieldTypes.vbp. Run the project just to make sure that you have entered all the code correctly up to this point. If you get error messages from Visual Basic, refer back to Table 2.2 and the preceding code lines to correct the problem. |
|
|
|
|
|
|
|
|
Testing the BOOLEAN Data Type |
|
|
|
|
|
|
|
|
Now you can add a text box input control and a label to this form. Set the caption of the label to Boolean:. Set the DataSource property of the text box to datFieldTypes and the DataField property to BooleanField. Set the Text property to blank. Refer to Figure 2.9 for placement and sizing. |
|
|
|
|
|